package edu.cuit.avatar.view;

import edu.cuit.avatar.handler.BookHandler;
import edu.cuit.avatar.handler.Command;

/**
 * @author <a href="mailto:1020zhaodan@163.com">Adan</a>
 * @version 1.0
 * @date 2025/7/15 15:58
 */
public class BookApplication {
    private static BookHandler handler = new BookHandler();
    public void view(){
        System.out.println("********欢迎使用图书管理系统********");
        System.out.println("i. 添加新的图书");
        System.out.println("d. 删除图书信息");
        System.out.println("u. 更新图书信息");
        System.out.println("a. 加载所有的图书信息");
        System.out.println("f. 查找指定的图书信息");
        System.out.println("e. 退出系统");
        System.out.println("*********************************");
        System.out.println("请按键选择:");
    }

    public static void main(String[] args) {
        BookApplication application = new BookApplication();
        char command = '\u0000';
        do{
           application.view();
           command = handler.readInput().charAt(0);
           //处理指令
            handler.process(Command.getCommandByShortCharacter(command));
        }while(command != 'e');
    }
}
